﻿<%@ Control Language="vb" AutoEventWireup="false" Explicit ="true" codefile="SignUp.ascx.vb" Inherits="NVPortal.Modules.NVUser.SignUp" %>
<div class="AcountInfoBox">
    <div style="width:70%;float:left;border: 1px solid #BDC7D8;padding-top :4px;">
         <table cellspacing="5" cellpadding="0" border="0" width="100%">  
            <tr>
                <td colspan="2" class="lblinfocontact">
                    <p id="ErrorValidate" class="error" style="display: none;"><asp:label runat="server" ID="lblError"></asp:label></p>
                </td>
            </tr> 
            <%--Thông tin đăng nhập--%>
            <tr style="padding-bottom:15px;">
                <td colspan="2" style="border-bottom: 1px solid #BDC7D8;padding-top :15px;">
                    <asp:Label CssClass="lblTitleBox" ID="Label2" runat="server" Text ="Thông tin đăng nhập" resourcekey="lblAcountPane"></asp:Label><br />
                </td>
            </tr>
        </table>
        <asp:UpdatePanel runat="server" ID="pnlAjaxCheckAvailable" UpdateMode="Conditional">
            <contenttemplate>
                <table cellspacing="5" cellpadding="0" border="0" width="100%">  
                   <tr>      
                        <td class="lableFormerStudent"><asp:Label ID="lblUserName" Text="Tài khoản" runat="server" resourcekey="lblUserName"></asp:Label>(<font style=" color:red">*</font>)</td>
                        <td>
                            <asp:TextBox CssClass="TextBoxCSS" ID="txtUserName" runat="server"  MaxLength ="100" ></asp:TextBox>
                            <asp:Button ID="btnCheckExistUser" Text="Kiểm tra tồn tại" runat="server" resourcekey="btnCheckAvailable"/>
                            <asp:Label  id="ErrorValidateServer" CssClass="error" runat ="server"></asp:Label>
                        </td>
                   </tr> 
                </table> 
            </contenttemplate>
        </asp:UpdatePanel> 
    
        <table cellspacing="5" cellpadding="0" border="0" width="100%">       
            <tr>      
                <td class="lableFormerStudent"><asp:Label ID="lblPassword" Text="Mật khẩu" runat="server" resourcekey="lblPassword"></asp:Label>(<font style=" color:red">*</font>)</td>
                <td><asp:TextBox CssClass="TextBoxCSS"  ID="txtPassword" TextMode="Password"  runat="server"  MaxLength ="100" ></asp:TextBox><font class="Example"> Chú ý : Mật khẩu có ít nhất là 7 ký tự</font></td>
           </tr> 
             <tr>      
                <td class="lableFormerStudent"><asp:Label ID="lblConfirmPassword" Text="Nhập lại mật khẩu" runat="server" resourcekey="lblConfirmPassword"></asp:Label>(<font style=" color:red">*</font>)</td>
                <td><asp:TextBox CssClass="TextBoxCSS"  ID="txtConfirmPassword" runat="server"  TextMode="Password"  MaxLength ="100" ></asp:TextBox></td>
           </tr> 
             <%--Thông tin cơ bản--%>
           <tr style="padding-bottom:15px;"><td colspan="2" style="border-bottom: 1px solid #BDC7D8;padding-top :15px;"><asp:Label CssClass="lblTitleBox" ID="Label11" runat="server" Text ="Thông tin cá nhân" resourcekey="lbloverviewInfoPane"></asp:Label><br /></td></tr>
           <tr>
                <td class="lableFormerStudent"><asp:Label ID="lblFullName" runat="server" resourcekey="lblFullName"></asp:Label></td>
                <td>
                    <asp:TextBox CssClass="TextBoxCSS" ID="txtHo" runat="server"   MaxLength ="20" width="80"></asp:TextBox>
                    <asp:TextBox CssClass="TextBoxCSS" ID="txtDem" runat="server"   MaxLength ="20" width="80"></asp:TextBox>
                    <asp:TextBox CssClass="TextBoxCSS"  ID="txtTen" runat="server"   MaxLength ="20" width="80"></asp:TextBox>
                    (<font style=" color:red">*</font>)
                </td>
           </tr>
           <tr>
                <td class="lableFormerStudent"><asp:Label ID="lblDateOfBirth" runat="server" resourcekey="lblDateOfBirth"></asp:Label></td>
                <td>
                    <asp:DropDownList ID="ddlDay" CssClass="TextBoxCSS" runat="server" width="80"> 
                        <asp:ListItem Text ="01" Value="1"></asp:ListItem>
                        <asp:ListItem Text ="02" Value="2"></asp:ListItem>
                        <asp:ListItem Text ="03" Value="3"></asp:ListItem>
                        <asp:ListItem Text ="04" Value="4"></asp:ListItem>
                        <asp:ListItem Text ="05" Value="5"></asp:ListItem>
                        <asp:ListItem Text ="06" Value="6"></asp:ListItem>
                        <asp:ListItem Text ="07" Value="7"></asp:ListItem>
                        <asp:ListItem Text ="08" Value="8"></asp:ListItem>
                        <asp:ListItem Text ="09" Value="9"></asp:ListItem>
                        <asp:ListItem Text ="10" Value="10"></asp:ListItem>
                        <asp:ListItem Text ="11" Value="11"></asp:ListItem>
                        <asp:ListItem Text ="12" Value="12"></asp:ListItem>
                        <asp:ListItem Text ="13" Value="13"></asp:ListItem>
                        <asp:ListItem Text ="14" Value="14"></asp:ListItem>
                        <asp:ListItem Text ="15" Value="15"></asp:ListItem>
                        <asp:ListItem Text ="16" Value="16"></asp:ListItem>
                        <asp:ListItem Text ="17" Value="17"></asp:ListItem>
                        <asp:ListItem Text ="18" Value="18"></asp:ListItem>
                        <asp:ListItem Text ="19" Value="19"></asp:ListItem>
                        <asp:ListItem Text ="20" Value="20"></asp:ListItem>
                        <asp:ListItem Text ="21" Value="21"></asp:ListItem>
                        <asp:ListItem Text ="22" Value="22"></asp:ListItem>
                        <asp:ListItem Text ="23" Value="23"></asp:ListItem>
                        <asp:ListItem Text ="24" Value="24"></asp:ListItem>
                        <asp:ListItem Text ="25" Value="25"></asp:ListItem>
                        <asp:ListItem Text ="26" Value="26"></asp:ListItem>
                        <asp:ListItem Text ="27" Value="27"></asp:ListItem>
                        <asp:ListItem Text ="28" Value="28"></asp:ListItem>
                        <asp:ListItem Text ="29" Value="29"></asp:ListItem>
                        <asp:ListItem Text ="30" Value="30"></asp:ListItem>
                        <asp:ListItem Text ="31" Value="31"></asp:ListItem>
                    </asp:DropDownList>                
                    <asp:DropDownList ID="ddlMonth" CssClass="TextBoxCSS" runat="server" width="80"> 
                        <asp:ListItem Text ="Tháng 1" Value="1"></asp:ListItem>
                        <asp:ListItem Text ="Tháng 2" Value="2"></asp:ListItem>
                        <asp:ListItem Text ="Tháng 3" Value="3"></asp:ListItem>
                        <asp:ListItem Text ="Tháng 4" Value="4"></asp:ListItem>
                        <asp:ListItem Text ="Tháng 5" Value="5"></asp:ListItem>
                        <asp:ListItem Text ="Tháng 6" Value="6"></asp:ListItem>
                        <asp:ListItem Text ="Tháng 7" Value="7"></asp:ListItem>
                        <asp:ListItem Text ="Tháng 8" Value="8"></asp:ListItem>
                        <asp:ListItem Text ="Tháng 9" Value="9"></asp:ListItem>
                        <asp:ListItem Text ="Tháng 10" Value="10"></asp:ListItem>
                        <asp:ListItem Text ="Tháng 11" Value="11"></asp:ListItem>
                        <asp:ListItem Text ="Tháng 12" Value="12"></asp:ListItem>
                    </asp:DropDownList>                
                    <asp:DropDownList ID="ddlYear" CssClass="TextBoxCSS" runat="server" width="80">             
                   </asp:DropDownList> 
                </td> 
           </tr>      
           <tr>            
                <td class="lableFormerStudent"><asp:Label  ID="lblSex" runat="server" resourcekey="lblSex"></asp:Label></td>
                <td>       
                    <asp:DropDownList ID="drdSex"  CssClass="TextBoxCSS" runat="server" width="80">
                        <asp:ListItem Text="Nam" Value="Nam" />
                        <asp:ListItem Text="Nữ" Value="Nữ" />
                    </asp:DropDownList>
                </td>
           </tr>
           <tr>
                 <td class="lableFormerStudent"><asp:Label  ID="lblEmailUser" runat="server" resourcekey="lblEmail"></asp:Label>(<font style=" color:red">*</font>)</td>
                 <td><asp:TextBox CssClass="TextBoxCSS"  ID="txtEmail" runat="server"  MaxLength ="100"></asp:TextBox><font class="Example">vd: caunh@trinam.com.vn</font></td>
           </tr>
           <tr>
                 <td class="lableFormerStudent"><asp:Label  ID="Label6" Text="Điện thoại" runat="server" resourcekey="lblPhone"></asp:Label></td>
                 <td><asp:TextBox CssClass="TextBoxCSS" ID="txtPhone" runat="server"  MaxLength ="15"></asp:TextBox><font class="Example">vd: (+84) 473 086 888</font></td>
           </tr>
           <tr>
                 <td class="lableFormerStudent"><asp:Label  ID="lblCell" Text ="Di động" runat="server" resourcekey="lblCell"></asp:Label></td>
                 <td><asp:TextBox CssClass="TextBoxCSS"    ID="txtCell" runat="server"   MaxLength ="15"></asp:TextBox><font class="Example">vd: (+84) 9049 34568</font></td>
           </tr>
            <%--chức vụ phòng ban--%>
           <tr style="padding-bottom:15px;"><td colspan="2" style="border-bottom: 1px solid #BDC7D8;padding-top :15px;">
           <asp:Label CssClass="lblTitleBox" ID="Label9" runat="server" Text ="Chức vụ - Phòng ban" resourcekey="lblCurrentInfoPane"></asp:Label><br /></td></tr>
           <tr>            
                <td class="lableFormerStudent"><asp:Label  ID="lblDepartment" runat="server" Text="Phòng ban" resourcekey="lblDepartment"></asp:Label></td>
                <td>  
                  
                   <asp:DataGrid ID="drgViewData" BorderWidth="1px" CellPadding="2" GridLines="Both"
                        CssClass="QLVP_drgViewData" BackColor="#eff7ff" runat="server" DataKeyField="CategoryID"
                        AutoGenerateColumns="False" AllowPaging="false" Width="100%">
                        <Columns>
                             <asp:TemplateColumn HeaderText="Chọn danh mục">
                                <ItemTemplate>
                                    <asp:CheckBox ID="chkChon" ToolTip="Check vào đây để chọn phòng ban" runat="server" />
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Center" />
                            </asp:TemplateColumn>
                            <asp:BoundColumn HeaderText="M&#227;" DataField="CategoryID" Visible="false" />
                            <asp:BoundColumn HeaderText="Tên danh mục" DataField="CategoryName"/>
                            <asp:TemplateColumn HeaderText="TRưởng chuyên mục">
                                <ItemTemplate>
                                    <asp:CheckBox ID="chkLanhDao" ToolTip="Chọn mục này nếu là lãnh đạo của phòng" runat="server" />
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Center" />
                            </asp:TemplateColumn>
                        </Columns>
                       <ItemStyle CssClass="QLVP_ActivePage" />
                        <HeaderStyle Height="24px" CssClass="QLVP_TableHeader_Bg" />
                        <AlternatingItemStyle CssClass="QLVP_AlternatingItem" />
                        <PagerStyle Visible="false" />
                    </asp:DataGrid>
                           
                </td>
            </tr>
            <tr>
                 <td class="lableFormerStudent"><asp:Label  ID="lblDes" Text ="Diễn giải" runat="server" resourcekey="lblDes"></asp:Label></td>
                 <td><asp:TextBox CssClass="TextBoxCSS" ID="txtDes" runat="server" TextMode="MultiLine" Rows="3" Width="99%"></asp:TextBox></td>
            </tr>
              <tr>            
                <td class="lableFormerStudent"></td>
                <td>       
                    <asp:CheckBox ID="chkApprove" runat="server" Text="Kích hoạt" Checked="true" />                    
                </td>
            </tr>
        </table>
    </div>
    <%--Thông tin vai trò --%>
    <div style="width:29%;float:right;">
            <table cellspacing="5" cellpadding="0" border="0" width="98%" style="border: 1px solid #BDC7D8;padding-top :4px;"> 
                <tr style="padding-bottom:15px;"><td colspan="2" style="border-bottom: 1px solid #BDC7D8;padding-top :15px;"><asp:Label CssClass="lblTitleBox" ID="Label12" runat="server" Text="Vai trò của người này" resourcekey="lblSchoolInfoPane"></asp:Label><br /></td></tr>
                <tr>
                    <td colspan="2">
                        <asp:CheckBoxList ID="chkListRole" runat="server" ></asp:CheckBoxList>
                    </td>
                 </tr>   
            </table>
      </div>
</div>                 
<br />
<table cellspacing="5" cellpadding="0" border="0" width="100%">
    <tr>            
        <td class="lableFormerStudent"></td>
        <td>       
             <asp:LinkButton   ID="btnSignUp" runat="server" CssClass="QLVP_button" OnClientClick ="return isValidInfo();">
                <img src="/images/save.gif" border="0" /> Cập nhật
             </asp:LinkButton>&nbsp;
             <asp:LinkButton  ID="btnResetForm" runat ="server" CssClass="QLVP_button"  OnClientClick ="return ResetForm();">
                 <img src="/images/undo.gif" border="0" /> Làm lại
             </asp:LinkButton>                   
        </td>
    </tr>
</table>

<script type="text/javascript">	
    function alertError(error) {
        $('p.error').empty();
        $('p.error').append("<img src='/Images/cancelgray.gif' class='close' alt='Close' />");
        $('p.error').append(error);
        $('p.error').fadeIn('slow');
        $('img.close').click(function(){
            $('p.error').fadeOut('slow');
        });
    }	
    function focusAndAlert(name, arlertMess) {
        document.getElementById(name).style.border="red 1px solid";
        document.getElementById(name).focus();
        document.getElementById(name).select();
        alertError(arlertMess);
    }
    function refreshBack(name) {
        document.getElementById(name).style.border="#6991b6 1px solid";
    }
    function checkValidAt(name) {
        var val = document.getElementById(name).value;
        if (val=='' || val==null) return true;
        return false;
    }      
     function validate_email(name)
    {
        var val = document.getElementById(name).value;
        apos= val.indexOf("@");
        dotpos=val.lastIndexOf(".");
        if (apos<1||dotpos-apos<2) return false;
        return true;
        
    }    
    function CheckLengPass(name) 
    {
        var val = document.getElementById(name).value;
        if (val.length > 6 ) return true
        return false 
    } 
    function isValidInfo()
    {       
		if(checkValidAt('<% = txtUserName.ClientID %>'))
        {
            focusAndAlert('<% = txtUserName.ClientID  %>', 'Bạn chưa nhập tài khoản đăng nhập!');
            return false;
        }else
            {
				
                refreshBack('<% = txtUserName.ClientID  %>');   
            }
        if(checkValidAt('<% = txtPassword.ClientID %>'))
        {
            focusAndAlert('<% = txtPassword.ClientID  %>', 'Bạn chưa nhập mật khẩu !');
            return false;
        }else
            {
                refreshBack('<% = txtPassword.ClientID  %>');   
            }
        
        if(!CheckLengPass('<% = txtPassword.ClientID %>'))
        {
            focusAndAlert('<% = txtPassword.ClientID  %>', 'Mật khẩu phải có ít nhất 7 ký tự !');
            return false;
        }else
            {
                refreshBack('<% = txtConfirmPassword.ClientID  %>');   
            }
        if(checkValidAt('<% = txtConfirmPassword.ClientID %>'))
        {
            focusAndAlert('<% = txtConfirmPassword.ClientID  %>', 'Bạn chưa nhập lại mật khẩu!');
            return false;
        }else
            {
                refreshBack('<% = txtConfirmPassword.ClientID  %>');   
            }
       if( document.getElementById('<% = txtPassword.ClientID %>').value != document.getElementById('<% = txtConfirmPassword.ClientID %>').value)
        {
            focusAndAlert('<% = txtConfirmPassword.ClientID  %>', 'Nhập lại mật khẩu không đúng !');
            return false;
        }else
            {
                refreshBack('<% = txtConfirmPassword.ClientID  %>');   
            }
        
        if(checkValidAt('<% = txtTen.ClientID %>'))
        {
            focusAndAlert('<% = txtTen.ClientID  %>', 'Bạn chưa nhập tên!');
            return false;
        }else
            {
                refreshBack('<% = txtTen.ClientID  %>');   
            } 
        if(checkValidAt('<% = txtTen.ClientID %>'))
        {
            focusAndAlert('<% = txtTen.ClientID  %>', 'Bạn chưa nhập Email!');
            return false;
        }else
            {
                refreshBack('<% = txtEmail.ClientID  %>');   
            } 
        if(!validate_email('<% = txtEmail.ClientID %>'))
        {
            focusAndAlert('<% = txtEmail.ClientID  %>', 'Bạn nhập sai sai địa chỉ Email!');
            return false;
        }else
            {
                refreshBack('<% = txtEmail.ClientID  %>');   
            }  
       return true;
   }   
    function ResetForm()
    {                    
        $(':input')
		 .not(':button, :submit,:radio, :reset, :hidden')
		 .val('')
		 .removeAttr('selected');
        return false ;
    } 	
</script>